/*
 Copyright 2009 Abdulla Abdurakhmanov (abdulla@latestbit.com)
 Original sources are available at www.latestbit.com

 Licensed under the Apache License, Version 2.0 (the "License");
 you may not use this file except in compliance with the License.
 You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.

 StdHandshakeManagerFactory.hpp. Created on: 30.09.2009 12:33:47 
 */

#ifndef STDHANDSHAKEMANAGERFACTORY_HPP_
#define STDHANDSHAKEMANAGERFACTORY_HPP_

#include "smartobjects/SmartObjectsDefs.hpp"
#include "smartobjects/ISmartBus.hpp"
#include "IHandshakeManagerFactory.hpp"

namespace smartobjects {

class StdHandshakeManagerFactory : public IHandshakeManagerFactory {
public:
	SO_DLLPRFX StdHandshakeManagerFactory(ISmartBus* poBus);
	SO_DLLPRFX virtual ~StdHandshakeManagerFactory();

	SO_DLLPRFX virtual IHandshakeManager* createHandshakeManager(IConnection*);
	SO_DLLPRFX virtual IAsymmetricDataEncrypter* getAsymmetricDataEncrypter();
	SO_DLLPRFX virtual KeyPair* getKeyPair();
	SO_DLLPRFX virtual ISmartBus* getBus();

	SO_DLLPRFX virtual IConnectionAuthenticator* getConnectionAuthenticator () ;
	SO_DLLPRFX virtual void setConnectionAuthenticator (IConnectionAuthenticator* poAuthenticator);

	SO_DLLPRFX virtual void setHandshakeManagerListener(IHandshakeManagerListener* poListener);
	SO_DLLPRFX virtual IHandshakeManagerListener* getHandshakeManagerListener();

protected:
	ISmartBus* m_poBus;
	IConnectionAuthenticator* m_poConnectionAuthenticator;
	IHandshakeManagerListener* m_poHandshakeListener;

	KeyPair* m_poKeyPair;
	boost::recursive_mutex m_mxAsymmetricEncrypter;
	IAsymmetricDataEncrypter* m_poAsymmetricEncrypter;
};

}

#endif /* STDHANDSHAKEMANAGERFACTORY_HPP_ */
